<template>
  <div class="home">
    <div class="Numberofusers">
      <div>
        <p style="font-size:15px;opacity: 0.7;">用户数</p>
        <p style="font-size:20px;color:darkcyan">{{pagestatistics.users_count}}</p>
      </div>
    </div>
    <div class="Numberofusers">
      <div>
        <p style="font-size:15px;opacity: 0.7;">商品数</p>
        <p style="font-size:20px;color: brown;">{{pagestatistics.goods_count}}</p>
      </div>
    </div>
    <div class="Numberofusers">
      <div>
        <p style="font-size:15px;opacity: 0.7;">订单数</p>
        <p style="font-size:20px;color:cadetblue">{{pagestatistics.order_count}}</p>
      </div>
    </div>
  </div>
</template>

<script>
import Bus from '@/components/eventBus'
import { mapState } from 'vuex'
export default {
  name: 'HomeView',
  data() {
    return {
      list: [
        {
          name: '用户数',
          index: '123'
        },
        {
          name: '商品数',
          index: '123'
        },
        {
          name: '订单数',
          index: '123'
        }
      ]
    }
  },
  computed: {
    ...mapState({
      pagestatistics: state => state.login.pagestatistics
    })
  },
  mounted() {
    this.getHomepagestatistics()
    //路由一加载就传送相应的值给lefymenu页面
    Bus.$emit('show', 0)
  },
  methods: {
    getHomepagestatistics() {
      this.$store.dispatch('getHomepagestatistics')
    }
  },
  created() {
    Bus.$emit('login', true)
  },
  components: {}
}
</script>
<style lang="less" scoped>
.home {
  padding: 25px 25px;
  display: flex;
  justify-content: space-between;
  .Numberofusers {
    width: 30%;
    height: 100px;
    background-color: #fff;
    padding-left: 20px;
    display: flex;
    align-items: center;
  }
}
</style>
